package cn.kgc.tangcco.dao.impl;

import cn.kgc.tangcco.dao.PersonDao;
import cn.kgc.tangcco.dto.Person;
import org.apache.commons.lang3.StringUtils;

import java.util.List;

/**
 * @author 李昊哲
 * @Description
 * @create 2020/9/3 上午8:53
 */
public class PersonDaoImpl implements PersonDao {
    @Override
    public List<Person> selectPersonsByPerson(Person person) {
        StringBuilder sql = new StringBuilder("select * from person where 1 ");
        if (person != null) {
            if (!StringUtils.isEmpty(person.getUuid())){
                // 按照uuid查询
                sql.append(" and uuid = ? ");
            }
            if (person.getGender() != null){
                // 按照uuid查询
                sql.append(" and gender = ? ");
            }
            if (!StringUtils.isEmpty(person.getNickName())){
                // 按照uuid查询
                sql.append(" and nickname like %'?'%");
            }
        }
        System.out.println(sql.toString());
        return null;
    }
}
